{% extends 'utilities/obj_edit.html' %}
{% load form_helpers %}

{% block form %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Device</strong></div>
        <div class="panel-body">
            {% render_field form.name %}
            {% render_field form.device_role %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Hardware</strong></div>
        <div class="panel-body">
            {% render_field form.manufacturer %}
            {% render_field form.device_type %}
            {% render_field form.serial %}
            {% render_field form.asset_tag %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Location</strong></div>
        <div class="panel-body">
            {% render_field form.site %}
            {% render_field form.rack %}
            {% if obj.device_type.is_child_device and obj.parent_bay %}
                <div class="form-group">
                    <label class="col-md-3 control-label">Parent device</label>
                    <div class="col-md-9">
                        <p class="form-control-static">
                            <a href="{% url 'dcim:device' pk=obj.parent_bay.device.pk %}">{{ obj.parent_bay.device }}</a>
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">Parent bay</label>
                    <div class="col-md-9">
                        <p class="form-control-static">
                            {{ obj.parent_bay.name }}
                            {% if perms.dcim.change_devicebay %}
                                <a href="{% url 'dcim:devicebay_depopulate' pk=obj.parent_bay.pk %}" class="btn btn-danger btn-xs">
                                    <i class="glyphicon glyphicon-remove" aria-hidden="true" title="Remove device"></i> Remove
                                </a>
                            {% endif %}
                        </p>
                    </div>
                </div>
            {% else %}
                {% render_field form.face %}
                {% render_field form.position %}
            {% endif %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Management</strong></div>
        <div class="panel-body">
            {% render_field form.status %}
            {% render_field form.platform %}
            {% if obj.pk %}
                {% render_field form.primary_ip4 %}
                {% render_field form.primary_ip6 %}
            {% endif %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Virtualization</strong></div>
        <div class="panel-body">
            {% render_field form.cluster_group %}
            {% render_field form.cluster %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Tenancy</strong></div>
        <div class="panel-body">
            {% render_field form.tenant_group %}
            {% render_field form.tenant %}
        </div>
    </div>
    {% if form.custom_fields %}
        <div class="panel panel-default">
            <div class="panel-heading"><strong>Custom Fields</strong></div>
            <div class="panel-body">
                {% render_custom_fields form %}
            </div>
        </div>
    {% endif %}
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Local Config Context Data</strong></div>
        <div class="panel-body">
            {% render_field form.local_context_data %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Tags</strong></div>
        <div class="panel-body">
            {% render_field form.tags %}
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading"><strong>Comments</strong></div>
        <div class="panel-body">
            {% render_field form.comments %}
        </div>
    </div>
{% endblock %}
